Skip to main content

libURLftpUpload

Type

command

Summary

Uploads data to an Internet server asynchronously via FTP.

Syntax

libURLftpUpload <value>, <uploadURL> [, <callbackMessage>]

Description

Use the libURLftpUpload command to put a file on a server.

The libURLftpUpload command is non-blocking, so it does not stop the current handler while the upload is completed. The handler continues while the libURLftpUpload command uploads the URL in the background. You can monitor the upload by checking the URLStatus function periodically.

To upload a URL while blocking other operations, use the put command instead.

To upload a file, use the file URL type (for text files) or the binfile URL type (for binary files). Because referring to a file URL's contents loads the file into memory, if you are uploading a large file, make sure you have enough memory available. You can also use the libURLftpUploadFile command to upload a file.

The callbackMessage is sent to the object whose script contains the libURLftpUpload command, after the upload is complete, so you can handle the callbackMessage to perform any tasks you want to delay until the URL has been uploaded. Two parameters are sent with the message : the URL and the URLStatus of the file.

warning

Avoid using the wait command in a handler after executing the libURLftpUpload command. Since the libURLftpUpload command is non-blocking, it may still be running when your handler reaches the wait command. And since the libURLftpUpload command is part of the Internet library and is implemented in a handler, the wait command will stop the upload process if it is executed while the download is still going on. In particular, do not use constructions like the following, which will sit forever without uploading the file:

    libURLftpUpload field \"Upload Data\" ,myURL wait until the \
URLStatus of myURL is \"uploaded\" -- DON\'T DO THIS

The URLStatus function returns the status of the uploaded file. If you no longer need to monitor the file's status, use the unload command to remove it from the URLStatus function's listing.

Important

The libURLftpUpload command is part of the Internet library. To ensure that the command works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "Internet" script library is selected.

Parameters

NameTypeDescription

value

string

The data to upload.

uploadURL

The uploadURL specifies the server and location to upload to, in the form of an FTP URL.

callbackMessage

The name of a message to send after the URL is uploaded.

Examples

libURLftpUpload field "Data","ftp://ftp.example.org/file.txt"
libURLftpUpload URL "binfile:data.jef",myURL,"uploadDone"
libURLftpUpload myData,"ftp://me:secret@example.net/file.txt"

message: startup, openBackground, preOpenStack, openStack, preOpenCard

property: script

command: libURLSetStatusCallback, unload, put, load, libURLSetFTPStopTime, libURLftpUploadFile, wait, group, libURLSetFTPMode

control structure: function

function: URLStatus

glossary: object, LiveCode custom library, non-blocking, standalone application, application, handler, function, binary file, command, execute, URL, main stack, text file, Standalone Application Settings, server, upload, message, parameter, download

keyword: URL, ftp, file, binfile

library: Internet library, library

Compatibility and Support

Introduced

LiveCode 1.1.1

OS

mac

windows

linux

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?